<template>
  <div>
    <home-header></home-header>
    <home-content :productlist="productList" :swiperlist="swiperList" :newslist="newsList" :boardlist="boardList"></home-content>
    <home-footer></home-footer>
  </div>
</template>

<script>
import HomeHeader from './components/Header'
import HomeFooter from './components/Footer'
import HomeContent from './components/Content'
import HomeSwiper from './components/Swiper'
import axios from 'axios'
export default {
  name: 'Home',
  components: {
    HomeHeader,
    HomeFooter,
    HomeContent,
    HomeSwiper
  },
  data () {
    return {
      productList: {},
      newsList: [],
      boardList: [],
      swiperList: []
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('/app/list')// 代替http://localhost:3000/list
        .then(this.handleGetHomeInfo)
    },
    handleGetHomeInfo (res) {
      console.log(res)
      res = res.data
      if (res) {
        this.productList = res.productList
        this.newsList = res.newsList
        this.boardList = res.boardList
        this.swiperList = res.swiperList
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style lang="stylus" scoped>
</style>
